<!-- 试题单元列表 -->
<!DOCTYPE html>
<html>
  <head>
    <title>试题列表</title>
    <include file="./Public/html/_head.html"/>
    <style>
      #unit{
        display:none;
      }
    </style>
  </head>

  <body ontouchstart>

    <include file="./Public/html/_refresh.html"/>
    <header class='demos-header'>
      <h1 class="demos-title">试题列表</h1>
    </header>

    <div class="bd">
      <div class="weui_cells_title">请选择章节</div>
      <div class="weui_cells weui_cells_checkbox">
        <label class="weui_cell weui_check_label" for="s11">
          <div class="weui_cell_hd">
            <input type="checkbox" class="weui_check" name="checkbox1" id="s11">
            <i class="weui_icon_checked"></i>
            <div id="unit">1</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第一章 计算机网络基本概念 （{$queNum[0]['num']}道题）</p> 
          </div>
        </label>
        <label class="weui_cell weui_check_label" for="s12">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s12">
            <i class="weui_icon_checked"></i>
            <div id="unit">2</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第二章 物理层 （{$queNum[1]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        <label class="weui_cell weui_check_label" for="s13">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s13">
            <i class="weui_icon_checked"></i>
            <div id="unit">3</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第三章 数据链路层 （{$queNum[2]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        <label class="weui_cell weui_check_label" for="s14">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s14">
            <i class="weui_icon_checked"></i>
            <div id="unit">4</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第四章 介质访问控制子层 （{$queNum[3]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        <label class="weui_cell weui_check_label" for="s15">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s15">
            <i class="weui_icon_checked"></i>
            <div id="unit">5</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第五章 网络层 （{$queNum[4]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        <label class="weui_cell weui_check_label" for="s16">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s16">
            <i class="weui_icon_checked"></i>
            <div id="unit">6</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第六章 传输层 （{$queNum[5]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        <label class="weui_cell weui_check_label" for="s17">
          <div class="weui_cell_hd">
            <input type="checkbox" name="checkbox1" class="weui_check" id="s17">
            <i class="weui_icon_checked"></i>
            <div id="unit">7</div>
          </div>
          <div class="weui_cell_bd weui_cell_primary">
            <p>第七章 应用层 （{$queNum[6]['num']}道题）</p>
          </div>
          <div class="weui_cell_ft"></div>
        </label>
        </a>
      </div>
    </div>
    <div class="weui_btn_area">
      <a class="weui_btn weui_btn_primary" href="javascript:" id="submit">确定</a>
    </div>
  </body>
</html>
<include file="./Public/html/_foot.html"/>
<include file="./Public/html/_refreshJs.html"/>
<script>
$('#submit').click(function(){
  var unit = '';
  $(":checked").each(function(){
    unit += $(this).siblings('#unit').html();
  });

  if(unit === '') {$.toptip('你还没有选择章节','warning');return false;}

  $.modal({
    title: "提示",
    text: "你需要自定义题目数量吗？",
    buttons: [
      { 
        text: "是", onClick: function(){ 
          $.prompt("不得出现非法数量", "输入题目数量", function(text) {
              if(text.length >= 3) $.toptip('题目数量非法','warning');
              else if(text == 1) $.toptip('题目数量必须超过1','warning');
              else if(isNaN(text)) $.toptip('题目内容非法','warning');
              else window.location.href="test_ques_list/unit/"+unit+"/number/"+text;
          }, function() {
            //取消操作
          });  
        } 
      },
      { 
        text: "否", onClick: function(){ 
          window.location.href="test_ques_list/unit/"+unit;
        } 
      },
      { 
        text: "取消", 
        className: "default"
      },
    ]
  });
  
  
});
</script>
